home *** CD-ROM | disk | FTP | other *** search
/ Programming an RTS Game with Direct3D / Programming an RTS Game with Direct3D.iso / Examples / Chapter 3 / Example 3.1 / debug.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2006-07-01  |  674 b   |  24 lines

  1. #include "debug.h"
  2.  
  3. std::ofstream out("debug.txt");
  4.  
  5. DEBUG::DEBUG()
  6. {
  7. }
  8.  
  9. DEBUG::~DEBUG()
  10. {
  11.     if(out.good())
  12.         out.close();
  13. }
  14.  
  15. void DEBUG::Print(char c[])
  16. {
  17.     out << c << std::endl;
  18. }
  19. std::ofstream& DEBUG::operator<<(char c[]){out << c; return out;}
  20. std::ofstream& DEBUG::operator<<(int i){out << i; return out;}
  21. std::ofstream& DEBUG::operator<<(float f){out << f; return out;}
  22. std::ofstream& DEBUG::operator<<(bool b){if(b)out << "True"; else out << "False"; return out;}
  23. std::ofstream& DEBUG::operator<<(D3DXVECTOR3 v){out << "x: " << v.x << ", y: " << v.y << ", z: " << v.z;return out;}
  24. void DEBUG::Endl(int nr){for(int i=0;i<nr;i++)out << std::endl;}